<template>
    <div>
        <div class="cell">
            <div class="cell_item" v-for="(item, index) in list" :key="index">
                <div>
                    <p class="flex-v-center">{{item.name}}<em>（{{['支付宝', '微信', '银行卡'][+item.bankAccountType]}}）</em></p>
                    <div class="fs28"> 提现金额：{{item.totalMoney}} </div>
                </div>
                <div>
                    <p> {{item.bankCard}} </p>
                    <span class="fs26">{{['未审核', '通过', '', '已打款', '', '拒绝'][+item.examineStatus]}}</span>
                </div>
                <div>
                    <span class="fs26 color-ccc">{{item.createTime}}</span>
                </div>
            </div>
        </div>
        <pub-list-end :loading="scroll.loading" :max="scroll.max" :noData="scroll.noData"></pub-list-end>
    </div>
</template>

<script>
import { getCashTransferList } from '@/request/user'
export default {
    data() {
        return {
            list: [],
            scroll: {
                page: 1,
                size: 30,
                loading: false,
                max: false,
                noData: false,
            },
        }
    },
    onReachBottom() {
        this.onInfinite()
    },
    onLoad() {
        this.onRefresh()
    },
    methods: {
        getList(complete) {
            getCashTransferList({
                pageIndex: this.scroll.page,
                pageSize: this.scroll.size,
            }, { complete }).then(res => {
                this.list = this.scroll.page == 1 ? res.data.list : this.list.concat(res.data.list)
                this.scroll.max = this.list.length >= res.data.total
                this.scroll.noData = res.data.total == 0
            })
        },
        // 重头第一页刷新列表
        onRefresh() {
            this.scroll.loading = true
            this.scroll.max = false
            this.scroll.noData = false
            this.scroll.page = 1
            this.list = []
            this.getList(() => {
                this.scroll.loading = false;
                uni.stopPullDownRefresh()
            })
        },
        // 滚动到底部加载
        onInfinite() {
            if(this.scroll.loading || this.scroll.max) return
            this.scroll.loading = true
            this.scroll.page += 1
            this.getList(() => {
                this.scroll.loading = false
            })
        },
    }
}
</script>

<style lang="less" scoped>
.cell{
    padding: 20rpx 30rpx;
    .cell_item{
        background: #fff;
        border-radius: 10rpx;
        padding: 30rpx 30rpx;
        margin-bottom: 30rpx;
        >div{
            display: flex;
            margin-bottom: 15rpx;
            justify-content: space-between;
            em{
                margin-left: 20rpx;
                font-size: 26rpx;
                color: #999;
            }
        }
    }
}

</style>